package com.ruoyi.safe.controller.web;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.quality.domain.TQualityFileItem;
import com.ruoyi.safe.domain.BizExtensionRequests;
import com.ruoyi.safe.service.IBizExtensionRequestsService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 延期申请Controller
 *
 * @author ruoyi
 * @date 2023-12-08
 */

@RestController
@RequestMapping("/extension/requests")
@RequiredArgsConstructor
public class BizExtensionRequestsController extends BaseController {

    private final IBizExtensionRequestsService bizExtensionRequestsService;

    /**
     * 查询延期申请列表
     */
    @GetMapping("/list")
    public TableDataInfo list(BizExtensionRequests bizExtensionRequests)
    {
        startPage();
        List<BizExtensionRequests> list = bizExtensionRequestsService.selectBizExtensionRequestsList(bizExtensionRequests);
        return getDataTable(list);
    }

    /**
     * 查询延期申请
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bizExtensionRequestsService.selectBizExtensionRequestsById(id));
    }

    /**
     * 新增延期申请
     */
    @PostMapping
    public AjaxResult add(@RequestBody BizExtensionRequests bizExtensionRequests) {
        return toAjax(bizExtensionRequestsService.insertBizExtensionRequests(bizExtensionRequests));
    }

}
